/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.handlers.commands;

/**
 * This exception is raised by XREAggregateCommandHandler if it encounters any unrecognized command.
 * <p>
 * Note the exception will not be actually propagated but processed by XRECommandErrorHandler instead. It extends
 * XRECommandHandlerException.
 * <p>
 * <b>Thread Safety:</b> This class is not thread safe as its base class is not thread safe.
 *
 * @author liuliquan, 7realm
 * @version 1.0
 */
public class XREUnrecognizedCommandException extends XRECommandHandlerException {
    /** Serial version UID. */
    private static final long serialVersionUID = -3674944777024189539L;
    /**
     * The unrecognized command.
     * <p>
     * Initialized in constructor and will not change after. Can be any value. It has a getter.
     */
    private final String unrecognizedCommand;

    /**
     * Creates a new instance of XREUnrecognizedCommandException with given error message and unrecognized command.
     *
     * @param message the error message
     * @param unrecognizedCommand the unrecognized command
     */
    public XREUnrecognizedCommandException(String message, String unrecognizedCommand) {
        super(message);
        this.unrecognizedCommand = unrecognizedCommand;
    }

    /**
     * Creates a new instance of XREUnrecognizedCommandException with given error message, the cause and the
     * unrecognized command.
     *
     * @param message the error message
     * @param cause the cause of the exception
     * @param unrecognizedCommand the unrecognized command
     */
    public XREUnrecognizedCommandException(String message, Throwable cause, String unrecognizedCommand) {
        super(message, cause);
        this.unrecognizedCommand = unrecognizedCommand;
    }

    /**
     * Gets the unrecognized command.
     *
     * @return the unrecognized command
     */
    public String getUnrecognizedCommand() {
        return unrecognizedCommand;
    }
}